home *** CD-ROM | disk | FTP | other *** search
- --
- -- Panel management handlers
- --
-
- --
- -- Create field management handlers
- --
- on createFieldDown theLine
- global dgDkBlueColor
- put line theLine of field "visTypeList" into theType
- put line theLine of field "visNameList" into field "dragName"
- set the foreColor of member "dragName" to dgDkBlueColor
- set the textSize of member "dragName" to 12
- set the textFont of member "dragName" to "Helvetica"
- set the foreColor of member "dragWidth" to dgDkBlueColor
- set the textSize of member "dragWidth" to 12
- set the textFont of member "dragWidth" to "Helvetica"
-
- if theType = EMPTY then exit
- locShow 46
- case (theType) of
- "character":
- set panelType to "text panel"
- put line theLine of field "visWidthList" into field "dragWidth"
- locShow 47
- "numeric":
- set panelType to "numeric panel"
- put line theLine of field "visWidthList" & "," &¬
- line theLine of field "visDecimalsList" into field "dragWidth"
- locShow 47
- "logical":
- set panelType to "boolean panel"
- locHide 47
- "date":
- set panelType to "date panel"
- locHide 47
- "memo":
- set panelType to "memo panel"
- locHide 47
- end case
- set the castNum of sprite 45 to (the number of cast panelType)
- locShow 45
- repeat while the mouseDown is true
- checkFieldPanelDrag theType
- updateStage
- end repeat
- cursor 4
- locHide 45 -- hide the drag bar
- locHide 46
- locHide 47
- updateStage
- case (the frameLabel) of
- "create":
- checkFieldPanelDrop theLine
- "index":
- checkIndexPanelDrop theType, field "dragName", field "dragWidth"
- end case
- cursor -1
- end createFieldDown
-
- on checkFieldPanelDrag panelType
- put point(the mouseH, the mouseV) into mousePoint
- set the locV of sprite 45 to the mouseV
- set the locH of sprite 45 to the mouseH
- set the locV of sprite 46 to the mouseV - 16
- set the locH of sprite 46 to the mouseH + 25
- if panelType = "character" or panelType = "numeric" then
- set the locV of sprite 47 to the mouseV - 16
- set the locH of sprite 47 to the mouseH + 135
- end if
- case (the frameLabel) of
- "create":
- if inside(mousePoint, the rect of sprite 23) then
- set the castNum of sprite 23 to (the number of cast "trashOpen")
- else
- set the castNum of sprite 23 to (the number of cast "trashClosed")
- end if
- "index":
- if inside(mousePoint, the rect of sprite 13) then
- locShow 14 -- show the hilight bar
- else
- locHide 14
- end if
- end case
- end checkFieldPanelDrag
-
- on checkFieldPanelDrop theLine
- global topPointsToLine
- put point(the mouseH, the mouseV) into mousePoint
- if inside(mousePoint, the rect of sprite 23) then
- put topPointsToLine + theLine - 1 into delLine
- delete line delLine of field "masterNameList"
- delete line delLine of field "masterTypeList"
- delete line delLine of field "masterWidthList"
- delete line delLine of field "masterDecimalsList"
- put 1 into topPointsToLine
- set the castNum of sprite 23 to (the number of cast "trashClosed")
- doCreateScroll
- end if
- locHide 45
- locHide 46
- locHide 47
- updateStage
- end checkFieldPanelDrop
-
- on checkIndexPanelDrop theType, theField, theWidth
- global dgYellowColor
- put point(the mouseH, the mouseV) into mousePoint
- if inside(mousePoint, the rect of sprite 13) then
- -- in the drop zone, the index expression area
- locHide 14
- updateStage
- if the number of lines of field "indexExpr" = 5 then
- beep
- exit
- end if
- case (theType) of
- "character":
- put "UPPER(" & theField & ")" into expr
- "numeric":
- put "STR(" & theField & "," & theWidth & ")" into expr
- "logical":
- beep
- exit
- "date":
- put "DTOC(" & theField & ")" into expr
- "memo":
- beep
- exit
- end case
- if field "IndexExpr" = EMPTY then
- put expr into field "IndexExpr"
- else
- put field "IndexExpr" & " +" & RETURN & expr into field "indexExpr"
- end if
- end if
- set the textHeight of member "indexExpr" to 16
- set the textSize of member "indexExpr" to 12
- set the foreColor of member "indexExpr" to dgYellowColor
-
- end checkIndexPanelDrop
-
-
- --
- -- Bin management handlers
- --
- on binDown theSprite, panelType, fieldDefault, widthDefault
- puppetSprite theSprite,TRUE -- turn on the little bar guy
- locHide theSprite
- updateStage
- set the castNum of sprite 45 to (the number of cast panelType)
- locShow 45
- repeat while the mouseDown is true
- checkBinPanelDrag
- updateStage
- end repeat
- checkBinDrop panelType, fieldDefault, widthDefault
- locHide 45 -- hide the drag bar
- locShow theSprite -- show the little mini bar
- updateStage
- puppetSprite theSprite, FALSE
- end binDown
-
- on checkBinDrop panelType, fieldDefault, widthDefault
- put point(the mouseH, the mouseV) into mousePoint
- if inside(mousePoint, the rect of sprite 3) then
- updateStage
- put word 1 of panelType into theType
- showDefineField theType
- exit
- end if
- end checkBinDrop
-
- on checkBinPanelDrag
- put point(the mouseH, the mouseV) into mousePoint
- set the locV of sprite 45 to the mouseV
- set the locH of sprite 45 to the mouseH
- end checkBinPanelDrag
-
-
- on padIt s, theLen, c
- put theLen - (the number of chars of s) into newChars
- put "" into pad
- repeat with i = 1 to newChars
- put c after pad
- end repeat
- put s & pad into theString
- return theString
- end padIt
-
- on putFieldInfo
- global fieldSpec, topPointsToLine
- put item 1 of fieldSpec into theName
- put item 2 of fieldSpec into theType
- if theType = "C" or theType = "N" then
- put string(item 3 of fieldSpec) into theWidth
- end if
- if theType = "N" then put string(item 4 of fieldSpec) into theDecimals
-
- if field "masterNameList" <> EMPTY then
- put field "masterNameList" & RETURN into field "masterNameList"
- put field "masterTypeList" & RETURN into field "masterTypeList"
- put field "masterWidthList" & RETURN into field "masterWidthList"
- put field "masterDecimalsList" & RETURN into field "masterDecimalsList"
- end if
- case (theType) of
- "C":
- put field "masterNameList" & theName into field "masterNameList"
- put field "masterTypeList" & "character" into field "masterTypeList"
- put field "masterWidthList" & theWidth into field "masterWidthList"
- "N":
- put field "masterNameList" & theName into field "masterNameList"
- put field "masterTypeList" & "numeric" into field "masterTypeList"
- put field "masterWidthList" & theWidth into field "masterWidthList"
- put field "masterDecimalsList" & theDecimals into field "masterDecimalsList"
- "D":
- put field "masterNameList" & theName into field "masterNameList"
- put field "masterTypeList" & "date" into field "masterTypeList"
- "L":
- put field "masterNameList" & theName into field "masterNameList"
- put field "masterTypeList" & "logical" into field "masterTypeList"
- "M":
- put field "masterNameList" & theName into field "masterNameList"
- put field "masterTypeList" & "memo" into field "masterTypeList"
- end case
- put the number of lines of field "masterNameList" into theLines
- if theLines > 10 then
- put theLines - 9 into topPointsToLine
- else
- put 1 into topPointsToLine
- end if
- doCreateScroll
- end putFieldInfo